From 415d962575f21c50683322b3d170c700776fa657 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 16 May 2016 00:17:56 +0300 Subject: [PATCH] fix more tests with regex --- tests/test_cargo_bench.rs | 8 ++++---- tests/test_cargo_features.rs | 16 ++++++++-------- tests/test_cargo_freshness.rs | 8 ++++---- tests/test_cargo_profiles.rs | 4 ++-- tests/test_cargo_registry.rs | 2 +- tests/test_cargo_run.rs | 10 +++++----- tests/test_cargo_rustc.rs | 6 +++--- tests/test_cargo_rustdoc.rs | 8 ++++---- 8 files changed, 31 insertions(+), 31 deletions(-) diff --git a/tests/test_cargo_bench.rs b/tests/test_cargo_bench.rs index fcff692e2..51d02f707 100644 --- a/tests/test_cargo_bench.rs +++ b/tests/test_cargo_bench.rs @@ -36,16 +36,16 @@ test!(cargo_bench_simple { execs().with_stdout("hello\n")); assert_that(p.cargo("bench"), - execs().with_stdout(&format!("\ + execs().with_stderr(&format!("\ [COMPILING] foo v0.5.0 ({}) -[RUNNING] target[..]release[..]foo-[..] - +[RUNNING] target[..]release[..]foo-[..]", p.url())) + .with_stdout(" running 1 test test bench_hello ... bench: [..] 0 ns/iter (+/- 0) test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured -", p.url()))); +")); }); test!(bench_tarname { diff --git a/tests/test_cargo_features.rs b/tests/test_cargo_features.rs index 6b0335c4c..404dfd5ea 100644 --- a/tests/test_cargo_features.rs +++ b/tests/test_cargo_features.rs @@ -244,14 +244,14 @@ test!(no_feature_doesnt_build { .file("bar/src/lib.rs", "pub fn bar() {}"); assert_that(p.cargo_process("build"), - execs().with_status(0).with_stdout(format!("\ + execs().with_status(0).with_stderr(format!("\ [COMPILING] foo v0.0.1 ({dir}) ", dir = p.url()))); assert_that(p.process(&p.bin("foo")), execs().with_status(0).with_stdout("")); assert_that(p.cargo("build").arg("--features").arg("bar"), - execs().with_status(0).with_stdout(format!("\ + execs().with_status(0).with_stderr(format!("\ [COMPILING] bar v0.0.1 ({dir}/bar) [COMPILING] foo v0.0.1 ({dir}) ", dir = p.url()))); @@ -291,7 +291,7 @@ test!(default_feature_pulled_in { .file("bar/src/lib.rs", "pub fn bar() {}"); assert_that(p.cargo_process("build"), - execs().with_status(0).with_stdout(format!("\ + execs().with_status(0).with_stderr(format!("\ [COMPILING] bar v0.0.1 ({dir}/bar) [COMPILING] foo v0.0.1 ({dir}) ", dir = p.url()))); @@ -299,7 +299,7 @@ test!(default_feature_pulled_in { execs().with_status(0).with_stdout("bar\n")); assert_that(p.cargo("build").arg("--no-default-features"), - execs().with_status(0).with_stdout(format!("\ + execs().with_status(0).with_stderr(format!("\ [COMPILING] foo v0.0.1 ({dir}) ", dir = p.url()))); assert_that(p.process(&p.bin("foo")), @@ -392,7 +392,7 @@ test!(groups_on_groups_on_groups { .file("baz/src/lib.rs", "pub fn baz() {}"); assert_that(p.cargo_process("build"), - execs().with_status(0).with_stdout(format!("\ + execs().with_status(0).with_stderr(format!("\ [COMPILING] ba[..] v0.0.1 ({dir}/ba[..]) [COMPILING] ba[..] v0.0.1 ({dir}/ba[..]) [COMPILING] foo v0.0.1 ({dir}) @@ -436,7 +436,7 @@ test!(many_cli_features { .file("baz/src/lib.rs", "pub fn baz() {}"); assert_that(p.cargo_process("build").arg("--features").arg("bar baz"), - execs().with_status(0).with_stdout(format!("\ + execs().with_status(0).with_stderr(format!("\ [COMPILING] ba[..] v0.0.1 ({dir}/ba[..]) [COMPILING] ba[..] v0.0.1 ({dir}/ba[..]) [COMPILING] foo v0.0.1 ({dir}) @@ -497,7 +497,7 @@ test!(union_features { "#); assert_that(p.cargo_process("build"), - execs().with_status(0).with_stdout(format!("\ + execs().with_status(0).with_stderr(format!("\ [COMPILING] d2 v0.0.1 ({dir}/d2) [COMPILING] d1 v0.0.1 ({dir}/d1) [COMPILING] foo v0.0.1 ({dir}) @@ -531,7 +531,7 @@ test!(many_features_no_rebuilds { .file("a/src/lib.rs", ""); assert_that(p.cargo_process("build"), - execs().with_status(0).with_stdout(format!("\ + execs().with_status(0).with_stderr(format!("\ [COMPILING] a v0.1.0 ({dir}/a) [COMPILING] b v0.1.0 ({dir}) ", dir = p.url()))); diff --git a/tests/test_cargo_freshness.rs b/tests/test_cargo_freshness.rs index ead586de2..7e57a3f8a 100644 --- a/tests/test_cargo_freshness.rs +++ b/tests/test_cargo_freshness.rs @@ -21,7 +21,7 @@ test!(modifying_and_moving { .file("src/a.rs", ""); assert_that(p.cargo_process("build"), - execs().with_status(0).with_stdout(format!("\ + execs().with_status(0).with_stderr(format!("\ [COMPILING] foo v0.0.1 ({dir}) ", dir = path2url(p.root())))); @@ -33,7 +33,7 @@ test!(modifying_and_moving { File::create(&p.root().join("src/a.rs")).unwrap() .write_all(b"fn main() {}").unwrap(); assert_that(p.cargo("build"), - execs().with_status(0).with_stdout(format!("\ + execs().with_status(0).with_stderr(format!("\ [COMPILING] foo v0.0.1 ({dir}) ", dir = path2url(p.root())))); @@ -60,7 +60,7 @@ test!(modify_only_some_files { .file("tests/test.rs", ""); assert_that(p.cargo_process("build"), - execs().with_status(0).with_stdout(format!("\ + execs().with_status(0).with_stderr(format!("\ [COMPILING] foo v0.0.1 ({dir}) ", dir = path2url(p.root())))); assert_that(p.cargo("test"), @@ -79,7 +79,7 @@ test!(modify_only_some_files { // Make sure the binary is rebuilt, not the lib assert_that(p.cargo("build") .env("RUST_LOG", "cargo::ops::cargo_rustc::fingerprint"), - execs().with_status(0).with_stdout(format!("\ + execs().with_status(0).with_stderr(format!("\ [COMPILING] foo v0.0.1 ({dir}) ", dir = path2url(p.root())))); assert_that(&p.bin("foo"), existing_file()); diff --git a/tests/test_cargo_profiles.rs b/tests/test_cargo_profiles.rs index 02fdcdf2d..3b8d5e5ca 100644 --- a/tests/test_cargo_profiles.rs +++ b/tests/test_cargo_profiles.rs @@ -24,7 +24,7 @@ test!(profile_overrides { "#) .file("src/lib.rs", ""); assert_that(p.cargo_process("build").arg("-v"), - execs().with_status(0).with_stdout(&format!("\ + execs().with_status(0).with_stderr(&format!("\ [COMPILING] test v0.0.0 ({url}) [RUNNING] `rustc src{sep}lib.rs --crate-name test --crate-type lib \ -C opt-level=1 \ @@ -75,7 +75,7 @@ test!(top_level_overrides_deps { "#) .file("foo/src/lib.rs", ""); assert_that(p.cargo_process("build").arg("-v").arg("--release"), - execs().with_status(0).with_stdout(&format!("\ + execs().with_status(0).with_stderr(&format!("\ [COMPILING] foo v0.0.0 ({url}/foo) [RUNNING] `rustc foo{sep}src{sep}lib.rs --crate-name foo \ --crate-type dylib --crate-type rlib -C prefer-dynamic \ diff --git a/tests/test_cargo_registry.rs b/tests/test_cargo_registry.rs index 261509bae..f1ddce8b8 100644 --- a/tests/test_cargo_registry.rs +++ b/tests/test_cargo_registry.rs @@ -239,7 +239,7 @@ version required: ^0.0.1 Package::new("notyet", "0.0.1").publish(); assert_that(p.cargo("package"), - execs().with_status(0).with_stdout(format!("\ + execs().with_status(0).with_stderr(format!("\ [PACKAGING] foo v0.0.1 ({dir}) [VERIFYING] foo v0.0.1 ({dir}) [UPDATING] registry `[..]` diff --git a/tests/test_cargo_run.rs b/tests/test_cargo_run.rs index 913ba1cfc..8e7796403 100644 --- a/tests/test_cargo_run.rs +++ b/tests/test_cargo_run.rs @@ -19,13 +19,13 @@ test!(simple { "#); assert_that(p.cargo_process("run"), - execs().with_status(0).with_stdout(&format!("\ + execs().with_status(0) + .with_stderr(&format!("\ [COMPILING] foo v0.0.1 ({dir}) -[RUNNING] `target{sep}debug{sep}foo[..]` +[RUNNING] `target{sep}debug{sep}foo[..]`", dir = path2url(p.root()), sep = SEP)) + .with_stdout("\ hello -", - dir = path2url(p.root()), - sep = SEP))); +")); assert_that(&p.bin("foo"), existing_file()); }); diff --git a/tests/test_cargo_rustc.rs b/tests/test_cargo_rustc.rs index ab72e819b..d71ac6d79 100644 --- a/tests/test_cargo_rustc.rs +++ b/tests/test_cargo_rustc.rs @@ -27,7 +27,7 @@ test!(build_lib_for_foo { assert_that(p.cargo_process("rustc").arg("--lib").arg("-v"), execs() .with_status(0) - .with_stdout(format!("\ + .with_stderr(format!("\ [COMPILING] foo v0.0.1 ({url}) [RUNNING] `rustc src{sep}lib.rs --crate-name foo --crate-type lib -g \ --out-dir {dir}{sep}target{sep}debug \ @@ -55,7 +55,7 @@ test!(build_lib_and_allow_unstable_options { .arg("--").arg("-Z").arg("unstable-options"), execs() .with_status(0) - .with_stdout(format!("\ + .with_stderr(format!("\ [COMPILING] foo v0.0.1 ({url}) [RUNNING] `rustc src{sep}lib.rs --crate-name foo --crate-type lib -g \ -Z unstable-options \ @@ -241,7 +241,7 @@ test!(build_foo_with_bar_dependency { assert_that(foo.cargo_process("rustc").arg("-v").arg("--").arg("-Z").arg("unstable-options"), execs() .with_status(0) - .with_stdout(format!("\ + .with_stderr(format!("\ [COMPILING] bar v0.1.0 ([..]) [RUNNING] `[..] -g -C [..]` [COMPILING] foo v0.0.1 ({url}) diff --git a/tests/test_cargo_rustdoc.rs b/tests/test_cargo_rustdoc.rs index b8a965aa7..f8813c7d1 100644 --- a/tests/test_cargo_rustdoc.rs +++ b/tests/test_cargo_rustdoc.rs @@ -19,7 +19,7 @@ test!(rustdoc_simple { assert_that(p.cargo_process("rustdoc").arg("-v"), execs() .with_status(0) - .with_stdout(format!("\ + .with_stderr(format!("\ [DOCUMENTING] foo v0.0.1 ({url}) [RUNNING] `rustdoc src{sep}lib.rs --crate-name foo \ -o {dir}{sep}target{sep}doc \ @@ -42,7 +42,7 @@ test!(rustdoc_args { assert_that(p.cargo_process("rustdoc").arg("-v").arg("--").arg("--no-defaults"), execs() .with_status(0) - .with_stdout(format!("\ + .with_stderr(format!("\ [DOCUMENTING] foo v0.0.1 ({url}) [RUNNING] `rustdoc src{sep}lib.rs --crate-name foo \ -o {dir}{sep}target{sep}doc \ @@ -85,7 +85,7 @@ test!(rustdoc_foo_with_bar_dependency { assert_that(foo.cargo_process("rustdoc").arg("-v").arg("--").arg("--no-defaults"), execs() .with_status(0) - .with_stdout(format!("\ + .with_stderr(format!("\ [COMPILING] bar v0.0.1 ([..]) [RUNNING] `rustc [..]bar{sep}src{sep}lib.rs [..]` [DOCUMENTING] foo v0.0.1 ({url}) @@ -132,7 +132,7 @@ test!(rustdoc_only_bar_dependency { .arg("--").arg("--no-defaults"), execs() .with_status(0) - .with_stdout(format!("\ + .with_stderr(format!("\ [DOCUMENTING] bar v0.0.1 ([..]) [RUNNING] `rustdoc [..]bar{sep}src{sep}lib.rs --crate-name bar \ -o {dir}{sep}target{sep}doc \ -- 2.30.2